package com.downloading.bezoyaapp.lists;

import java.util.ArrayList;

import com.downloading.bezoyaapp.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class ListWithNameAdapter extends BaseAdapter {

	private ArrayList _data;
	Context _c;

	public ListWithNameAdapter(ArrayList data, Context c) {
		_data = data;
		_c = c;
	}

	public int getCount() {
		// TODO Auto-generated method stub
		return _data.size();
	}

	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return _data.get(position);
	}

	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		OnlyNameListIntem msg = (OnlyNameListIntem) _data.get(position);

		View v = convertView;
		if (v == null) {
			LayoutInflater vi = (LayoutInflater) _c
					.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			v = vi.inflate(android.R.layout.simple_list_item_1, null);
			v.setTag(msg.getId());

		}

		TextView text = (TextView) v.findViewById(android.R.id.text1);

		text.setText(msg.getName());
		return v;
	}
}
